package com.sample.events
{
	import flash.events.Event;

	public class NavigationEvent extends Event
	{
 		public static const NAVIGATE:String = "navigationNavigate";
        public static const BACK:String = "navigateBack";
        public static const NEXT:String = "navigateNext";
        public static const SAVE_PAGE:String = "navigateSavePage";
        public static const RESTORE_PAGE:String = "navigateRestorePage";
        public static const STOP:String = "navigateStop";
        public static const RELOAD:String = "navigateReload";
        
        public var page:String;
        public var params:Object;
        public var askStopCurrentProgress:Boolean;
        
        public function NavigationEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
        {
            super(type, bubbles, cancelable);
        }
        
        public static function create(page:String, params:Object=null):NavigationEvent
        {
            var ne:NavigationEvent = new NavigationEvent(NavigationEvent.NAVIGATE, true);
            ne.page = page;
            ne.params = params;
            ne.askStopCurrentProgress = true;
            return ne;
        }
        
        public static function back():NavigationEvent
        {
            return new NavigationEvent(NavigationEvent.BACK, true);
        }
        
        public static function next():NavigationEvent
        {
            return new NavigationEvent(NavigationEvent.NEXT, true);
        }
        
        public static function reload():NavigationEvent
        {
            return new NavigationEvent(NavigationEvent.RELOAD, true);
        }

        public static function stop():NavigationEvent
        {
            return new NavigationEvent(NavigationEvent.STOP, true);
        }

	}
}